<?php
/*
$JA#COPYRIGHT$
*/

  defined('_JEXEC') or die('Retricted Access');    
  
  global $jbconfig, $option;  
  //$filter_order = JRequest::getVar('filter_order');
//$filter_order_Dir = JRequest::getVar('filter_order_Dir');
$Itemid = JRequest::getVar('Itemid');
?>
<script type="text/javascript">
/* <![CDATA[ */
   
function isEmployerChecked(formObj, isitchecked)
{
	if (isitchecked == true){
		formObj.boxchecked.value++;
	}
	else {
		formObj.boxchecked.value--;
	}
}

function submitbutton(pressbutton, number, formEmp){
    	if (pressbutton!='job_list_via_profiles')
    		formEmp.view.value = 'japrofiles';
    	else{
    		formEmp.view.value = 'jajobs';
    		formEmp.action = "<?php echo  JURI::root().'index.php?option=com_jajobboard&view=jajobs'; ?>";
    	}
    	
		formEmp.task.value = pressbutton;
		formEmp.submit();
    }
    
function updateselectedprofiles(formObj,obj){
	if (!obj.checked){
		$('li_'+obj.value).removeClass('selected');
//		obj.checked = false;
	}
	else{
		$('li_'+obj.value).addClass('selected');
//		obj.checked = true;
	}
	
	formObj.selectedJobs.value = formObj.boxchecked.value + ' ' + profile_select_text;
	formObj.selectedJobs2.value = formObj.boxchecked.value + ' ' + profile_select_text;
}

function updateselectallprofiles(formObj,obj,num_obj){
	
	if (obj.checked)
		formObj.boxchecked.value = num_obj;
	else
		formObj.boxchecked.value = 0;
	
	for (i=0;i<num_obj;i++)
	{
		if (obj.checked)
			formObj.elements['cb'+i].checked = true;
		else
			formObj.elements['cb'+i].checked = false;
		updateselectedprofiles(formObj,formObj.elements['cb'+i]);
	}
	formObj.selectedJobs.value = formObj.boxchecked.value + ' ' + profile_select_text;
	formObj.selectedJobs2.value = formObj.boxchecked.value + ' ' + profile_select_text;
}

/* ]]> */
</script>
<div id="jobboard-content_2">
<form name="emplForm<?php echo $module->id;?>" action="<?php echo JRoute::_('index.php');?>" method="post">    
		<?php 
		$modID = $module->id;;
		if(isset($this->fieldlist) && count($this->fieldlist)>0){
			jimport('joomla.filesystem.file');
			$profile_theme = JRequest::getVar('theme');
			if (!$profile_theme)
				$profile_theme = $params->get('theme_name','use_component');
			if ($profile_theme=='use_component')
				$profile_theme = $jbconfig['general']->get('theme', 'default');
					
			$path = JPATH_SITE.DS.'components'.DS.'com_jajobboard'.DS.'views'.DS.'japrofiles'.DS.'tmpl'.DS;
			if ($profile_theme!='default')
				$path_themes = $path.'themes'.DS.$profile_theme.DS.'jalist-item.php';
			else 
			{
				$this->pagination = $model->getPagination();
				$path_themes = dirname(__FILE__).DS.'themes'.DS.'default'.DS.'jalist-item.php';
			}
			if(JFile::exists($path_themes)){
				if(file_exists($path.'themes'.DS.$profile_theme.DS.'style.css')){
			    	JHTML::stylesheet('style.css', "components/com_jajobboard/views/japrofiles/tmpl/themes/$profile_theme/");
			    }	
				include $path_themes;					
			}
			else{
				$path_themes = dirname(__FILE__).DS.'themes'.DS.'default'.DS.'jalist-item.php';
				if(file_exists($path_themes)){
			    	JHTML::stylesheet('style.css', dirname(__FILE__).DS.'themes'.DS.'default'.DS);
			    	include $path_themes;	
			    }	
				
			}
		}
		?>
	<input type="hidden" name="option" value="com_jajobboard" />
	
    <input type="hidden" name="task" value="" />
	<!--<input type="hidden" name="table_name" value="<?php echo $this->table_name;?>" />-->
	<input type="hidden" name="boxchecked" id="boxchecked" value="0" />
	<input type="hidden" name="view" value="jajobs" />
	<!--<input type="hidden" name="cid" value="" />-->
	<input type="hidden" name="field" value="" />
	<input type="hidden" name="layout" value="jalist" />
	<input type="hidden" name="Itemid" value="1000" />
 </form>
 </div>
 <script type="text/javascript">
 	formObj<?php echo $module->id;?> = document.emplForm<?php echo $module->id;?>;
 </script>